package com_.dxy_.test_.aop_test_.target_;

import org.springframework.stereotype.Service;

/**
 * @Description JDK动态实现类
 * @Author dangxianyue
 * @Date 2022/9/26 21:08
 */
@Service("testAopServiceV1Impl")
public class TestAopServiceV1Impl implements TestAopServiceV1 {
    @Override
    public void f1() {
        System.out.println("testAopServiceV1Impl.f1()");
    }

    @Override
    public void f2() {
        try {
            //@Before
            System.out.println("testAopServiceV1Impl.f2()");
            int i = 1/0;
            //@AfterReturning
        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
            throw e;//异常不抛出则不会触发异常通知
            //@AfterThrowing
        } finally {
            System.out.println("Finally");
            //@After
        }
    }

    public void f3() {
        System.out.println("testAopServiceV1Impl.f3()");
    }
}
